package String;

public class StringDemo {
    public static void main(String[] args) {
        String s1 = "hello";
        String s2 = "hello";
        String s3 = "hello";
        System.out.println(s1==s2);
        System.out.println(s1==s3);
        System.out.println(s2==s3);
        s1+='!';
        System.out.println(s1==s2);
//        创建两个对象
        String s = new String("hello");
        String s4 = "hello";
        System.out.println(s == s4);
//        比较内容是否相同
        System.out.println(s.equals(s4));
    }
}
